<template>
	<view>
		
		<!-- 导航栏 -->
		 <u-navbar title="修改个人信息"
		 title-color="#000000"
		  titleCenter="true"  
		  title-bold ="false"
		  back-icon-color = "#000000"
		  :is-back="true"  
		  :background="background"
		  back-text =""
		  >	  
		 </u-navbar>
		
		
		
         <view class="wrap">
          <u-form :model="user" ref="uForm">
          
         <u-form-item label-width="140" label-position="left" label="新用户名"
        prop="zhanghao">
         <u-input :border="border" placeholder="请输入新的用户名" v-model="user.zhanghao"
        type="text"></u-input>
         </u-form-item>
         <u-form-item label-width="140" label-position="left" label="修改密码" prop="mima">
         <u-input :password-icon="true" :border="border" type="password" v-model="user.mima"
         placeholder="请输入新密码"></u-input>
         </u-form-item>
         <u-form-item label-width="140" label-position="left" label="确认密码" prop="rmima">
         <u-input :password-icon="true" :border="border" type="password" v-model="user.rmima"
         placeholder="请再确认密码"></u-input>
         </u-form-item>
        
		
		<u-form-item label-width="140"  label-position="left" label="自我介绍" prop="age">
		<u-input v-model="value" :type="type" :border="border" :height="height" :auto-height="autoHeight" />
	
		</u-input>
          </u-form-item>
        
        
          </u-form>
          <u-button @click="submit">确认</u-button>
          </view>
		  
		  </view>
</template>
		 
<script>
          export default {
          data() {
          return {
			  
			  background: {
			  					backgroundColor: '#aaffff',
			  					
			  					// 导航栏背景图
			  					// background: 'url(https://cdn.uviewui.com/uview/swiper/1.jpg) no-repeat',
			  					// 还可以设置背景图size属性
			  					// backgroundSize: 'cover',
			  					
			  					// 渐变色
			  					// backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
			  				},
			  
			  value: '',
			  				type: 'textarea',
			  				border: true,
			  				height: 200,
			  				autoHeight: true,
			  
          border: true,
          user: { },
            
          
          }
          },
          methods: {
             submit() {
          console.log(this.user);
            //检查两次密码是否一致
        	if(this.user.mima != this.user.rmima){
        		//提交
        		this.$u.toast("两次密码输入不同");
        		//终止代码
        		return
        	}
        	//到这里说明密码相同
        	//发送网络修改信息请求
        	uni.request({
        		url:"http://localhost:8080/doRegister",
        		data:this.user,
        		method:"POST",
        		success:(res)=>{
        			console.log(res);
        			if(res.data.code*1==200){
        				uni.navigateBack()
        			}else{ 
        			
        					this.$u.toast('用户信息修改失败，请重试')
        				
        			}
        		}
        	})
          },
           radioChange(e) {
           //console.log(e.detail)
           console.log(e,"radio",this.user.leibie)
           //this.user.leibie = e.detail.value
           },
           radioGroupChange(e){
           console.log(e,"group",this.user.leibie)
           }
           }
           }
           
        
        
          </script>
          <style>
          </style>